package com.xinyi.reactivemvvm.sources.repository.impl;

import com.xinyi.reactivemvvm.model.NeteaseCommentModel;
import com.xinyi.reactivemvvm.model.Resource;
import com.xinyi.reactivemvvm.model.request.NeteaseCommentRequest;
import com.xinyi.reactivemvvm.sources.remote.NeteaseApi;
import com.xinyi.reactivemvvm.sources.repository.BaseRepository;
import com.xinyi.reactivemvvm.sources.repository.MainRepository;

import javax.inject.Inject;

/**
 * @author 杨耿雷
 * @date 2024/9/23 22:18
 * @description 主页数据仓库实现类
 */
public class MainRepositoryImpl extends BaseRepository implements MainRepository {

    /**
     * 网易云接口
     */
    private final NeteaseApi mNeteaseApi;

    @Inject
    public MainRepositoryImpl(NeteaseApi neteaseApi) {
        this.mNeteaseApi = neteaseApi;
    }

    @Override
    public FlowCollect<Resource<NeteaseCommentModel>> getNeteaseComment(NeteaseCommentRequest request) {
        return safeRemoteApiCall(() -> mNeteaseApi.getNeteaseComment(request));
    }
}
